﻿namespace WMS6.Web.Outbound
{
    using System;
    using System.Collections.Generic;
    using System.Drawing;
    using System.Web.UI;
    using System.Web.UI.HtmlControls;
    using System.Web.UI.WebControls;
    using WMS6.Web;
    using WMS6.Web.BaseInfoDetailServiceRef;
    using WMS6.Web.BaseInfoServiceRef;
    using WMS6.Web.OutboundServiceRef;
    using WMS6.Web.UserControls;

    public class ShippingOrderDetail : BasePage
    {
        protected HtmlAnchor aExpectedQty;
        protected HtmlAnchor ASkuID;
        protected Button btnCancel;
        protected Button btnSave;
        protected Button btnSaveContinue;
        protected CheckBox chkboxIsSubStitute;
        protected CheckBox chkboxOk2SubStitute;
        protected DropDownList ddlAllocateRule;
        protected DropDownList ddlPreAllocateRuleID;
        protected DropDownList ddlSkuRotation;
        protected DropDownList ddlStatus;
        protected DropDownList ddlUomID;
        protected HtmlForm F7013;
        protected HtmlInputHidden hdncalendarFlag;
        protected HtmlInputHidden hdnCube;
        protected HtmlInputHidden hdnDataFormat;
        protected HiddenField hdnExpiryDate;
        protected HiddenField hdnExternal;
        protected HtmlInputHidden hdnExternOrderID;
        protected HtmlInputHidden hdnFormart;
        protected HtmlInputHidden hdnFrom;
        protected HtmlInputHidden hdnGrossWgt;
        protected HtmlInputHidden hdnIntransitID;
        protected HiddenField hdnLot1;
        protected HiddenField hdnLot10;
        protected HiddenField hdnLot2;
        protected HiddenField hdnLot3;
        protected HiddenField hdnLot4;
        protected HiddenField hdnLot5;
        protected HiddenField hdnLot6;
        protected HiddenField hdnLot7;
        protected HiddenField hdnLot8;
        protected HiddenField hdnLot9;
        protected HtmlInputHidden hdnNetWgt;
        protected HtmlInputHidden hdnOrderID;
        protected HtmlInputHidden hdnOwnerID;
        protected HtmlInputHidden hdnPageQty;
        protected HtmlInputHidden hdnPageType;
        protected HiddenField hdnProductDate;
        protected HtmlInputHidden hdnSettingSkuIDDuplicate;
        protected HtmlInputHidden hdnSkuID;
        protected HtmlInputHidden hdnSkuIDDuplicate;
        protected HtmlInputHidden hdnType;
        protected HtmlInputHidden hdnUnitPrice;
        protected HtmlInputHidden hdnUomValue;
        protected Label lblAllocatedQty;
        protected Label lblAllocateRuleDetail;
        protected Label lblAllocateRuleID;
        protected Label lblCube;
        protected Label lblExtendedPrice;
        protected Label lblExternLineID;
        protected Label lblGrossWgt;
        protected Label lblHeight;
        protected Label lblInvQty;
        protected Label lblLength;
        protected Label lblLineID;
        protected Label lblMsg;
        protected Label lblNetWgt;
        protected Label lblOriginalLineID;
        protected Label lblOriginalQty;
        protected Label lblOriginalSku;
        protected Label lblPackedQty;
        protected Label lblPackingID;
        protected Label lblPickingInstructions;
        protected Label lblPreallocatedQty;
        protected Label lblPreallocateRuleID;
        protected Label lblReceiptDate;
        protected Label lblRemark;
        protected Label lblSalsePrice;
        protected Label lblShippedQty;
        protected Label lblSkuDesrc;
        protected Label lblSkuID;
        protected Label lblSkuRoTation;
        protected Label lblStatus;
        protected Label lblUdf1;
        protected Label lblUdf10;
        protected Label lblUdf2;
        protected Label lblUdf3;
        protected Label lblUdf4;
        protected Label lblUdf5;
        protected Label lblUdf6;
        protected Label lblUdf7;
        protected Label lblUdf8;
        protected Label lblUdf9;
        protected Label lblUomID;
        protected Label lblVendorID;
        protected Label lblWidth;
        protected LotAtrributeCtrl LotAtrributeCtrl1;
        protected HtmlLink mycss;
        protected Label one1;
        protected Label one2;
        protected ScriptManager ScriptManager1;
        protected TextBox txtAllocatedQty;
        protected TextBox txtCube;
        protected TextBox txtExtemdedrice;
        protected TextBox txtExternLineID;
        protected TextBox txtGrossWgt;
        protected TextBox txtHeight;
        protected TextBox txtInvQty;
        protected TextBox txtLength;
        protected TextBox txtLineID;
        protected TextBox txtNetWgt;
        protected TextBox txtOriginalLineID;
        protected TextBox txtOriginalQty;
        protected TextBox txtOriginalSku;
        protected TextBox txtPackedQty;
        protected TextBox txtPackID;
        protected TextBox txtPickingInstuctions;
        protected TextBox txtPreallocatedQty;
        protected TextBox txtReceiptDate;
        protected TextBox txtRemark;
        protected TextBox txtSalsePrice;
        protected TextBox txtShippedQty;
        protected TextBox txtSkuDesrc;
        protected TextBox txtSkuID;
        protected TextBox txtUdf1;
        protected TextBox txtUdf10;
        protected TextBox txtUdf2;
        protected TextBox txtUdf3;
        protected TextBox txtUdf4;
        protected TextBox txtUdf5;
        protected TextBox txtUdf6;
        protected TextBox txtUdf7;
        protected TextBox txtUdf8;
        protected TextBox txtUdf9;
        protected TextBox txtVendorID;
        protected TextBox txtWidth;
        protected UpdatePanel up1;

        private void BindData2UomList(string packID)
        {
            try
            {
                List<WMS6.Web.CommonMethodServiceRef.UomList> uomList = CommoneMethodServiceClientProxy.GetInstance().GetUomListByPackID(packID);
                if ((uomList != null) && (uomList.Count > 0))
                {
                    base.BindUomList2DDL(this.ddlUomID, uomList);
                    this.ViewState["UOMLIST"] = uomList;
                    this.CalcSkuWgtCube();
                }
            }
            catch (Exception ex)
            {
                this.lblMsg.Text = base.GetGlobalMsgResource("F4100_030") + ex.Message;
                this.txtPackID.Focus();
            }
        }

        protected void btnCancel_Click(object sender, EventArgs e)
        {
            base.Server.Transfer(string.Format("ShippingOrder.aspx?from={0}&detail={1}&ID={2}", base.UrlEncode(this.hdnFrom.Value), "6", base.UrlEncode(this.hdnOrderID.Value.Trim())));
        }

        protected void btnSave_Click(object sender, EventArgs e)
        {
            if (this.ddlStatus.SelectedValue.ToUpper() != "NEW")
            {
                this.lblMsg.Text = base.GetGlobalMsgResource("F7100_029");
            }
            else if (string.IsNullOrEmpty(this.txtOriginalQty.Text.Trim()))
            {
                this.lblMsg.Text = base.GetGlobalMsgResource("F7100_025");
            }
            else if (decimal.Parse(this.txtOriginalQty.Text.Trim()) <= 0M)
            {
                this.lblMsg.Text = base.GetGlobalMsgResource("F7100_037");
            }
            else if (string.IsNullOrEmpty(this.txtSkuID.Text.Trim()))
            {
                this.lblMsg.Text = base.GetGlobalMsgResource("F7100_026");
            }
            else if (string.IsNullOrEmpty(this.txtPackID.Text.Trim()))
            {
                this.lblMsg.Text = base.GetGlobalMsgResource("F7100_027");
            }
            else if (string.IsNullOrEmpty(this.ddlUomID.SelectedValue))
            {
                this.lblMsg.Text = "包装" + this.txtPackID.Text + " 未找到对应的计量单位！";
            }
            else
            {
                if ((string.IsNullOrEmpty(this.hdnType.Value) || (this.hdnType.Value != "edit")) && (!string.IsNullOrEmpty(this.txtSkuID.Text.Trim()) && (this.hdnSkuIDDuplicate.Value != "Y")))
                {
                    string settingSkuIDDuplicate = string.Empty;
                    if (string.IsNullOrEmpty(this.hdnSettingSkuIDDuplicate.Value))
                    {
                        SysSettingInfo sysSetting = BaseInfoServiceClientProxy.GetInstance().GetInfoByID("AllowSKUDuplicate", "SYS_SETTING") as SysSettingInfo;
                        if (sysSetting != null)
                        {
                            settingSkuIDDuplicate = sysSetting.Value;
                        }
                    }
                    if ((settingSkuIDDuplicate != "Y") && (OutboundServiceClientProxy.GetInstance().CheckSkuIDExist(this.hdnOrderID.Value.Trim(), this.txtSkuID.Text.Trim()) == "Y"))
                    {
                        if (settingSkuIDDuplicate == "N")
                        {
                            this.lblMsg.Text = string.Format(base.GetGlobalMsgResource("F4100_043"), this.txtSkuID.Text.Trim());
                            return;
                        }
                        if (settingSkuIDDuplicate == "A")
                        {
                            ScriptManager.RegisterStartupScript(this.Page, base.GetType(), "", "<script language='javascript'>SaveSkuIDDuplicate();</script>", false);
                            return;
                        }
                    }
                }
                bool success = false;
                try
                {
                    success = this.Insert0rUpdateOrderDetail();
                }
                catch (Exception ex)
                {
                    this.lblMsg.Text = base.GetGlobalMsgResource("F7100_030") + ex.Message;
                    return;
                }
                if (success)
                {
                    base.Response.Redirect(string.Format("ShippingOrder.aspx?from={0}&detail={1}&ID={2}", base.UrlEncode(this.hdnFrom.Value), "6", base.UrlEncode(this.hdnOrderID.Value.Trim())), false);
                }
            }
        }

        protected void btnSaveContinue_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(this.txtOriginalQty.Text.Trim()))
            {
                this.lblMsg.Text = base.GetGlobalMsgResource("F7100_025");
            }
            else if (decimal.Parse(this.txtOriginalQty.Text.Trim()) <= 0M)
            {
                this.lblMsg.Text = base.GetGlobalMsgResource("F7100_037");
            }
            else if (string.IsNullOrEmpty(this.txtSkuID.Text.Trim()))
            {
                this.lblMsg.Text = base.GetGlobalMsgResource("F7100_026");
            }
            else if (string.IsNullOrEmpty(this.txtPackID.Text.Trim()))
            {
                this.lblMsg.Text = base.GetGlobalMsgResource("F7100_027");
            }
            else if (string.IsNullOrEmpty(this.ddlUomID.SelectedValue))
            {
                this.lblMsg.Text = "包装" + this.txtPackID.Text + " 未找到对应的计量单位！";
            }
            else
            {
                if ((string.IsNullOrEmpty(this.hdnType.Value) || (this.hdnType.Value != "edit")) && (!string.IsNullOrEmpty(this.txtSkuID.Text.Trim()) && (this.hdnSkuIDDuplicate.Value != "Y")))
                {
                    string settingSkuIDDuplicate = string.Empty;
                    if (string.IsNullOrEmpty(this.hdnSettingSkuIDDuplicate.Value))
                    {
                        SysSettingInfo sysSetting = BaseInfoServiceClientProxy.GetInstance().GetInfoByID("AllowSKUDuplicate", "SYS_SETTING") as SysSettingInfo;
                        if (sysSetting != null)
                        {
                            settingSkuIDDuplicate = sysSetting.Value;
                        }
                    }
                    if ((settingSkuIDDuplicate != "Y") && (OutboundServiceClientProxy.GetInstance().CheckSkuIDExist(this.hdnOrderID.Value.Trim(), this.txtSkuID.Text.Trim()) == "Y"))
                    {
                        if (settingSkuIDDuplicate == "N")
                        {
                            this.lblMsg.Text = string.Format(base.GetGlobalMsgResource("F4100_043"), this.txtSkuID.Text.Trim());
                            return;
                        }
                        if (settingSkuIDDuplicate == "A")
                        {
                            ScriptManager.RegisterStartupScript(this.Page, base.GetType(), "", "<script language='javascript'>SaveContinueSkuIDDuplicate();</script>", false);
                            return;
                        }
                    }
                }
                bool success = false;
                try
                {
                    success = this.Insert0rUpdateOrderDetail();
                }
                catch (Exception ex)
                {
                    this.lblMsg.Text = base.GetGlobalMsgResource("F7100_028") + ex.Message;
                    return;
                }
                if (success)
                {
                    this.lblMsg.Text = this.txtLineID.Text + base.GetGlobalMsgResource("F7100_011");
                    this.txtLineID.Text = (int.Parse(this.txtLineID.Text.Trim()) + 10).ToString();
                    this.txtExternLineID.Text = "";
                    this.txtSkuID.Text = "";
                    this.txtSkuDesrc.Text = "";
                    this.txtPackID.Text = "";
                    this.ddlUomID.Items.Clear();
                    this.ddlStatus.SelectedValue = "New";
                    this.txtOriginalQty.Text = "";
                    if (this.ddlPreAllocateRuleID.Items.Count > 0)
                    {
                        this.ddlPreAllocateRuleID.SelectedValue = this.ddlPreAllocateRuleID.Items[0].Value;
                    }
                    if (this.ddlAllocateRule.Items.Count > 0)
                    {
                        this.ddlAllocateRule.SelectedValue = this.ddlAllocateRule.Items[0].Value;
                    }
                    if (this.ddlSkuRotation.Items.Count > 0)
                    {
                        this.ddlSkuRotation.SelectedValue = this.ddlSkuRotation.Items[0].Value;
                    }
                    this.txtCube.Text = "";
                    this.txtGrossWgt.Text = "";
                    this.txtNetWgt.Text = "";
                    this.txtRemark.Text = "";
                    this.hdnPageType.Value = "0";
                    this.hdnPageQty.Value = "0";
                    this.hdnSkuIDDuplicate.Value = string.Empty;
                }
                this.hdnPageQty.Value = "0";
                this.CountrolsClick();
                this.txtSkuID.Focus();
            }
        }

        private void CalcSkuWgtCube()
        {
            List<WMS6.Web.CommonMethodServiceRef.UomList> uomList = this.ViewState["UOMLIST"] as List<WMS6.Web.CommonMethodServiceRef.UomList>;
            float uomQty = base.GetUomQtyByUomList(this.ddlUomID.SelectedValue, uomList);
            this.hdnUomValue.Value = uomQty.ToString();
            if (uomQty > 0f)
            {
                float cube = string.IsNullOrEmpty(this.hdnCube.Value.Trim()) ? 0f : float.Parse(this.hdnCube.Value.Trim());
                float grossWgt = string.IsNullOrEmpty(this.hdnGrossWgt.Value.Trim()) ? 0f : float.Parse(this.hdnGrossWgt.Value.Trim());
                float netWgt = string.IsNullOrEmpty(this.hdnNetWgt.Value.Trim()) ? 0f : float.Parse(this.hdnNetWgt.Value.Trim());
                float price = string.IsNullOrEmpty(this.hdnUnitPrice.Value.Trim()) ? 0f : float.Parse(this.hdnUnitPrice.Value.Trim());
                float expectedQty = string.IsNullOrEmpty(this.txtOriginalQty.Text.Trim()) ? 0f : float.Parse(this.txtOriginalQty.Text.Trim());
                this.txtCube.Text = base.GetPreferenceDigit((float) ((cube * uomQty) * expectedQty));
                this.txtGrossWgt.Text = base.GetPreferenceDigit((float) ((grossWgt * uomQty) * expectedQty));
                this.txtNetWgt.Text = base.GetPreferenceDigit((float) ((netWgt * uomQty) * expectedQty));
                this.txtExtemdedrice.Text = base.GetPreferenceDigit((float) ((price * uomQty) * expectedQty));
            }
            else
            {
                this.txtCube.Text = base.GetPreferenceDigit(0);
                this.txtGrossWgt.Text = base.GetPreferenceDigit(0);
                this.txtNetWgt.Text = base.GetPreferenceDigit(0);
                this.txtExtemdedrice.Text = base.GetPreferenceDigit(0);
            }
        }

        private void CountrolsClick()
        {
            this.ddlStatus.Attributes.Add("RecordValue", "0");
            this.ddlStatus.Attributes.Add("onfocusout", "RecordPageValue('" + this.ddlStatus.SelectedItem.Text + "',this, 'hdnPageQty'); return true; ");
            this.txtExternLineID.Attributes.Add("RecordValue", "0");
            this.txtExternLineID.Attributes.Add("onfocusout", "RecordPageValue('" + this.txtExternLineID.Text + "',this, 'hdnPageQty'); return true; ");
            this.txtSkuDesrc.Attributes.Add("RecordValue", "0");
            this.txtSkuDesrc.Attributes.Add("onfocusout", "RecordPageValue('" + this.txtSkuDesrc.Text + "',this, 'hdnPageQty'); return true; ");
            this.txtPackID.Attributes.Add("RecordValue", "0");
            this.txtPackID.Attributes.Add("onfocusout", "RecordPageValue('" + this.txtPackID.Text + "',this, 'hdnPageQty'); return true; ");
            this.ddlPreAllocateRuleID.Attributes.Add("RecordValue", "0");
            this.ddlPreAllocateRuleID.Attributes.Add("onfocusout", "RecordPageValue('" + this.ddlPreAllocateRuleID.SelectedItem.Text + "',this, 'hdnPageQty'); return true; ");
            this.ddlAllocateRule.Attributes.Add("RecordValue", "0");
            this.ddlAllocateRule.Attributes.Add("onfocusout", "RecordPageValue('" + this.ddlAllocateRule.SelectedItem.Text + "',this, 'hdnPageQty'); return true; ");
            this.ddlSkuRotation.Attributes.Add("RecordValue", "0");
            this.ddlSkuRotation.Attributes.Add("onfocusout", "RecordPageValue('" + this.ddlSkuRotation.SelectedItem.Text + "',this, 'hdnPageQty'); return true; ");
            this.txtOriginalQty.Attributes.Add("RecordValue", "0");
            this.txtOriginalQty.Attributes.Add("onfocusout", "RecordPageValue('" + this.txtOriginalQty.Text + "',this, 'hdnPageQty'); return true; ");
            this.txtPreallocatedQty.Attributes.Add("RecordValue", "0");
            this.txtPreallocatedQty.Attributes.Add("onfocusout", "RecordPageValue('" + this.txtPreallocatedQty.Text + "',this, 'hdnPageQty'); return true; ");
            this.txtAllocatedQty.Attributes.Add("RecordValue", "0");
            this.txtAllocatedQty.Attributes.Add("onfocusout", "RecordPageValue('" + this.txtAllocatedQty.Text + "',this, 'hdnPageQty'); return true; ");
            this.txtPackedQty.Attributes.Add("RecordValue", "0");
            this.txtPackedQty.Attributes.Add("onfocusout", "RecordPageValue('" + this.txtPackedQty.Text + "',this, 'hdnPageQty'); return true; ");
            this.txtShippedQty.Attributes.Add("RecordValue", "0");
            this.txtShippedQty.Attributes.Add("onfocusout", "RecordPageValue('" + this.txtShippedQty.Text + "',this, 'hdnPageQty'); return true; ");
            this.txtVendorID.Attributes.Add("RecordValue", "0");
            this.txtVendorID.Attributes.Add("onfocusout", "RecordPageValue('" + this.txtVendorID.Text + "',this, 'hdnPageQty'); return true; ");
            this.txtShippedQty.Attributes.Add("RecordValue", "0");
            this.txtShippedQty.Attributes.Add("onfocusout", "RecordPageValue('" + this.txtShippedQty.Text + "',this, 'hdnPageQty'); return true; ");
            this.txtShippedQty.Attributes.Add("RecordValue", "0");
            this.txtShippedQty.Attributes.Add("onfocusout", "RecordPageValue('" + this.txtShippedQty.Text + "',this, 'hdnPageQty'); return true; ");
            this.txtShippedQty.Attributes.Add("RecordValue", "0");
            this.txtShippedQty.Attributes.Add("onfocusout", "RecordPageValue('" + this.txtShippedQty.Text + "',this, 'hdnPageQty'); return true; ");
            this.txtShippedQty.Attributes.Add("RecordValue", "0");
            this.txtShippedQty.Attributes.Add("onfocusout", "RecordPageValue('" + this.txtShippedQty.Text + "',this, 'hdnPageQty'); return true; ");
            this.txtShippedQty.Attributes.Add("RecordValue", "0");
            this.txtShippedQty.Attributes.Add("onfocusout", "RecordPageValue('" + this.txtShippedQty.Text + "',this, 'hdnPageQty'); return true; ");
            this.txtShippedQty.Attributes.Add("RecordValue", "0");
            this.txtShippedQty.Attributes.Add("onfocusout", "RecordPageValue('" + this.txtShippedQty.Text + "',this, 'hdnPageQty'); return true; ");
            this.txtShippedQty.Attributes.Add("RecordValue", "0");
            this.txtShippedQty.Attributes.Add("onfocusout", "RecordPageValue('" + this.txtShippedQty.Text + "',this, 'hdnPageQty'); return true; ");
            this.txtUdf1.Attributes.Add("RecordValue", "0");
            this.txtUdf1.Attributes.Add("onfocusout", "RecordPageValue('" + this.txtUdf1.Text + "',this, 'hdnPageQty'); return true; ");
            this.txtUdf2.Attributes.Add("RecordValue", "0");
            this.txtUdf2.Attributes.Add("onfocusout", "RecordPageValue('" + this.txtUdf2.Text + "',this, 'hdnPageQty'); return true; ");
            this.txtUdf3.Attributes.Add("RecordValue", "0");
            this.txtUdf3.Attributes.Add("onfocusout", "RecordPageValue('" + this.txtUdf3.Text + "',this, 'hdnPageQty'); return true; ");
            this.txtUdf4.Attributes.Add("RecordValue", "0");
            this.txtUdf4.Attributes.Add("onfocusout", "RecordPageValue('" + this.txtUdf4.Text + "',this, 'hdnPageQty'); return true; ");
            this.txtUdf5.Attributes.Add("RecordValue", "0");
            this.txtUdf5.Attributes.Add("onfocusout", "RecordPageValue('" + this.txtUdf5.Text + "',this, 'hdnPageQty'); return true; ");
            this.txtUdf6.Attributes.Add("RecordValue", "0");
            this.txtUdf6.Attributes.Add("onfocusout", "RecordPageValue('" + this.txtUdf6.Text + "',this, 'hdnPageQty'); return true; ");
            this.txtUdf7.Attributes.Add("RecordValue", "0");
            this.txtUdf7.Attributes.Add("onfocusout", "RecordPageValue('" + this.txtUdf7.Text + "',this, 'hdnPageQty'); return true; ");
            this.txtUdf8.Attributes.Add("RecordValue", "0");
            this.txtUdf8.Attributes.Add("onfocusout", "RecordPageValue('" + this.txtUdf8.Text + "',this, 'hdnPageQty'); return true; ");
            this.txtUdf9.Attributes.Add("RecordValue", "0");
            this.txtUdf9.Attributes.Add("onfocusout", "RecordPageValue('" + this.txtUdf9.Text + "',this, 'hdnPageQty'); return true; ");
            this.txtUdf10.Attributes.Add("RecordValue", "0");
            this.txtUdf10.Attributes.Add("onfocusout", "RecordPageValue('" + this.txtUdf10.Text + "',this, 'hdnPageQty'); return true; ");
        }

        protected void ddlUomID_SelectedIndexChanged(object sender, EventArgs e)
        {
            this.CalcSkuWgtCube();
        }

        private bool Insert0rUpdateOrderDetail()
        {
            DateTime CS00002;
            bool success = false;
            float tempDec = 0f;
            OrderDetailInfo orderDetail = null;
            if (base.DataEntityViewState != null)
            {
                orderDetail = base.DataEntityViewState as OrderDetailInfo;
            }
            else
            {
                orderDetail = new OrderDetailInfo();
            }
            orderDetail.ExternOrderID = this.hdnExternOrderID.Value;
            orderDetail.AltSkuID = "";
            orderDetail.PickCode = "";
            orderDetail.CartonGroup = "";
            orderDetail.LpnID = "";
            orderDetail.UpdateSource = "";
            if (float.TryParse(this.hdnUnitPrice.Value, out tempDec))
            {
                orderDetail.UnitPrice = float.Parse(this.hdnUnitPrice.Value);
            }
            else
            {
                orderDetail.UnitPrice = tempDec;
            }
            if (float.TryParse(this.txtExtemdedrice.Text, out tempDec))
            {
                orderDetail.ExtendedPrice = float.Parse(this.txtExtemdedrice.Text.Trim());
            }
            else
            {
                orderDetail.ExtendedPrice = tempDec;
            }
            if (float.TryParse(this.txtHeight.Text, out tempDec))
            {
                orderDetail.Height = float.Parse(this.txtHeight.Text.Trim());
            }
            else
            {
                orderDetail.Height = tempDec;
            }
            if (float.TryParse(this.txtWidth.Text, out tempDec))
            {
                orderDetail.Width = float.Parse(this.txtWidth.Text.Trim());
            }
            else
            {
                orderDetail.Width = tempDec;
            }
            if (float.TryParse(this.txtLength.Text, out tempDec))
            {
                orderDetail.Length = float.Parse(this.txtLength.Text.Trim());
            }
            else
            {
                orderDetail.Length = tempDec;
            }
            if (float.TryParse(this.txtNetWgt.Text, out tempDec))
            {
                orderDetail.NetWGT = float.Parse(this.txtNetWgt.Text.Trim());
            }
            else
            {
                orderDetail.NetWGT = tempDec;
            }
            if (float.TryParse(this.txtGrossWgt.Text, out tempDec))
            {
                orderDetail.GrossWGT = float.Parse(this.txtGrossWgt.Text.Trim());
            }
            else
            {
                orderDetail.GrossWGT = tempDec;
            }
            if (float.TryParse(this.txtCube.Text, out tempDec))
            {
                orderDetail.Cube = float.Parse(this.txtCube.Text.Trim());
            }
            else
            {
                orderDetail.Cube = tempDec;
            }
            orderDetail.QcRequired = "N";
            orderDetail.QcAutoAdjust = "N";
            orderDetail.ShipGroup01 = "Y";
            orderDetail.ShipGroup02 = "N";
            orderDetail.ShipGroup03 = "N";
            orderDetail.WpReleased = "N";
            orderDetail.Lot = "";
            orderDetail.LineID = int.Parse(this.txtLineID.Text.Trim());
            orderDetail.OrderID = this.hdnOrderID.Value.Trim();
            orderDetail.IntransitID = this.hdnIntransitID.Value;
            orderDetail.OwnerID = this.hdnOwnerID.Value.Trim();
            orderDetail.Status = this.ddlStatus.SelectedValue;
            orderDetail.ExternLineID = this.txtExternLineID.Text.Trim();
            orderDetail.SkuID = this.txtSkuID.Text.Trim();
            orderDetail.PackID = this.txtPackID.Text.Trim();
            orderDetail.UomID = this.ddlUomID.SelectedValue;
            orderDetail.OriginalQty = decimal.Parse(this.txtOriginalQty.Text.Trim());
            orderDetail.PreallocateRuleID = this.ddlPreAllocateRuleID.SelectedValue;
            orderDetail.AllocateRuleID = this.ddlAllocateRule.SelectedValue;
            orderDetail.SkuRotation = this.ddlSkuRotation.SelectedValue;
            orderDetail.ExternalLot = this.hdnExternal.Value;
            orderDetail.VendorID = this.txtVendorID.Text.Trim();
            orderDetail.ReceiptDate = string.IsNullOrEmpty(this.txtReceiptDate.Text.Trim()) ? (CS00002 = new DateTime()) : DateTime.Parse(this.txtReceiptDate.Text.Trim());
            orderDetail.EffectiveDate = DateTime.Now;
            orderDetail.OkToSubstitute = this.chkboxOk2SubStitute.Checked ? 1 : 0;
            orderDetail.LotAttr01 = "";
            orderDetail.LotAttr02 = "";
            orderDetail.LotAttr03 = "";
            orderDetail.LotAttr04 = "";
            orderDetail.LotAttr05 = "";
            orderDetail.LotAttr06 = "";
            orderDetail.LotAttr07 = "";
            orderDetail.LotAttr08 = "";
            orderDetail.LotAttr09 = "";
            orderDetail.LotAttr10 = "";
            List<Control> lotControls = this.Session["LotAttributeControls"] as List<Control>;
            this.Session["LotAttributeControls"] = null;
            if (lotControls != null)
            {
                foreach (Control ctrl in lotControls)
                {
                    string temp = "";
                    object objTemp = base.Request.Form[this.LotAtrributeCtrl1.ClientID.ToString() + "$" + ctrl.ID.ToString()];
                    if (objTemp != null)
                    {
                        temp = objTemp.ToString();
                    }
                    if (ctrl.ID == "txtProduct")
                    {
                        if (!string.IsNullOrEmpty(temp))
                        {
                            orderDetail.ProduceDate = DateTime.Parse(temp);
                        }
                        else
                        {
                            CS00002 = new DateTime();
                            orderDetail.ProduceDate = CS00002;
                        }
                    }
                    else if (ctrl.ID == "txtExpiryDate")
                    {
                        if (!string.IsNullOrEmpty(temp))
                        {
                            orderDetail.ExpiryDate = DateTime.Parse(temp);
                        }
                        else
                        {
                            CS00002 = new DateTime();
                            orderDetail.ExpiryDate = CS00002;
                        }
                    }
                    else if (ctrl.ID == "txtExternalLot")
                    {
                        if (!string.IsNullOrEmpty(temp))
                        {
                            orderDetail.ExternalLot = temp;
                        }
                        else
                        {
                            orderDetail.ExternalLot = "";
                        }
                    }
                    else
                    {
                        switch (ctrl.ID.Substring(4))
                        {
                            case "1":
                                orderDetail.LotAttr01 = temp;
                                break;

                            case "2":
                                orderDetail.LotAttr02 = temp;
                                break;

                            case "3":
                                orderDetail.LotAttr03 = temp;
                                break;

                            case "4":
                                orderDetail.LotAttr04 = temp;
                                break;

                            case "5":
                                orderDetail.LotAttr05 = temp;
                                break;

                            case "6":
                                orderDetail.LotAttr06 = temp;
                                break;

                            case "7":
                                orderDetail.LotAttr07 = temp;
                                break;

                            case "8":
                                orderDetail.LotAttr08 = temp;
                                break;

                            case "9":
                                orderDetail.LotAttr09 = temp;
                                break;

                            case "10":
                                orderDetail.LotAttr10 = temp;
                                break;
                        }
                    }
                }
            }
            orderDetail.Udf1 = this.txtUdf1.Text;
            orderDetail.Udf2 = this.txtUdf2.Text;
            orderDetail.Udf3 = this.txtUdf3.Text;
            orderDetail.Udf4 = this.txtUdf4.Text;
            orderDetail.Udf5 = this.txtUdf5.Text;
            orderDetail.Udf6 = this.txtUdf6.Text;
            orderDetail.Udf7 = this.txtUdf7.Text;
            orderDetail.Udf8 = this.txtUdf8.Text;
            orderDetail.Udf9 = this.txtUdf9.Text;
            orderDetail.Udf10 = this.txtUdf10.Text;
            orderDetail.PickingInstructions = this.txtPickingInstuctions.Text;
            orderDetail.Remark = this.txtRemark.Text.Trim();
            if (!string.IsNullOrEmpty(this.hdnType.Value) && (this.hdnType.Value == "edit"))
            {
                orderDetail.UpdatedBy = base.UserInfo.UserID;
                if (!string.IsNullOrEmpty(OutboundServiceClientProxy.GetInstance().UpdateShippingOrderDetailInfo(orderDetail)))
                {
                    success = true;
                }
                return success;
            }
            orderDetail.CreatedBy = base.UserInfo.UserID;
            orderDetail.UpdatedBy = base.UserInfo.UserID;
            if (!string.IsNullOrEmpty(OutboundServiceClientProxy.GetInstance().InsertShippingOrderDetailInfo(orderDetail)))
            {
                success = true;
            }
            return success;
        }

        private void LoadData()
        {
            this.txtLineID.Enabled = false;
            this.hdnFormart.Value = base.UserInfo.Preference.Digits_No;
            base.BindData2DDLByRules(this.ddlPreAllocateRuleID, "PreallocateRule");
            base.BindData2DDLByRules(this.ddlAllocateRule, "AllocateRule");
            base.BindData2DDLByRules(this.ddlSkuRotation, "RotationRule");
            base.BindData2DDLBySysCode(this.ddlStatus, "OrderStatus");
            if (!string.IsNullOrEmpty(base.Request.QueryString["ID"]))
            {
                string orderID = base.Request.QueryString["ID"];
                this.hdnOrderID.Value = orderID;
            }
            if (!string.IsNullOrEmpty(base.Request.QueryString["from"]))
            {
                string from = base.Request.QueryString["from"];
                this.hdnFrom.Value = from;
            }
            if (!string.IsNullOrEmpty(base.Request.QueryString["SeqNO"]))
            {
                string LineID = base.Request.QueryString["SeqNO"];
                this.txtLineID.Text = LineID;
            }
            if (!string.IsNullOrEmpty(base.Request.QueryString["OwnerID"]))
            {
                string ownerID = base.Request.QueryString["OwnerID"];
                this.hdnOwnerID.Value = ownerID;
            }
            if (base.Request.QueryString["type"] != null)
            {
                this.hdnType.Value = base.Request.QueryString["type"].ToString();
                this.setShippingOrderDetail2From();
            }
            if (!(string.IsNullOrEmpty(base.Request.QueryString["BatchFlag"]) || !(base.Request.QueryString["BatchFlag"] == "Y")))
            {
                this.btnSave.Enabled = false;
                this.btnSaveContinue.Enabled = false;
            }
        }

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!base.IsPostBack)
            {
                base.InitPage(this.Page);
                this.LoadData();
            }
            this.LotAtrributeCtrl1.LoadData(this.txtSkuID.Text, this.hdnOwnerID.Value, this.LotAtrributeCtrl1.ClientID.ToString(), false, 4);
        }

        private void setShippingOrderDetail2From()
        {
            if ((!string.IsNullOrEmpty(this.hdnOrderID.Value) && !string.IsNullOrEmpty(this.txtLineID.Text)) && !string.IsNullOrEmpty(this.hdnOwnerID.Value))
            {
                OrderDetailInfo orderDetail = OutboundServiceClientProxy.GetInstance().GetShippingOrderDetailByID(this.hdnOrderID.Value, this.txtLineID.Text);
                if (orderDetail != null)
                {
                    this.btnSaveContinue.Enabled = false;
                    if (orderDetail != null)
                    {
                        this.ddlStatus.SelectedValue = orderDetail.Status;
                        this.txtExternLineID.Text = orderDetail.ExternLineID;
                        this.txtSkuID.Text = orderDetail.SkuID;
                        this.txtSkuID_TextChanged(null, null);
                        this.hdnSkuID.Value = orderDetail.SkuID;
                        SkuInfo skuInfo = BaseInfoDetailServiceClientProxy.GetInstance().GetDetailInfoByID(this.hdnOwnerID.Value, this.txtSkuID.Text, "", "SKU") as SkuInfo;
                        if (((skuInfo != null) && !string.IsNullOrEmpty(skuInfo.SkuID)) && !string.IsNullOrEmpty(skuInfo.OwnerID))
                        {
                            this.txtSkuDesrc.Text = skuInfo.Descr;
                            this.txtPackID.Text = skuInfo.PackID;
                            this.txtPackID_TextChanged(null, null);
                            this.BindData2UomList(this.txtPackID.Text.Trim());
                            this.hdnGrossWgt.Value = skuInfo.GrossWgt.ToString();
                            this.hdnNetWgt.Value = skuInfo.NetWgt.ToString();
                            this.txtInvQty.Text = base.GetPreferenceDigit(CommoneMethodServiceClientProxy.GetInstance().GetAvailableQty(skuInfo.OwnerID, skuInfo.SkuID));
                            if (decimal.Parse(this.txtInvQty.Text) > 0M)
                            {
                                if ((orderDetail.OriginalQty - orderDetail.ShippedQty) > decimal.Parse(this.txtInvQty.Text))
                                {
                                    this.txtOriginalQty.BackColor = Color.Yellow;
                                }
                                else
                                {
                                    this.txtOriginalQty.BackColor = Color.White;
                                }
                            }
                            else
                            {
                                this.txtOriginalQty.BackColor = Color.Red;
                            }
                        }
                        if (!string.IsNullOrEmpty(orderDetail.PreallocateRuleID) && (this.ddlPreAllocateRuleID.Items.FindByValue(orderDetail.PreallocateRuleID) != null))
                        {
                            this.ddlPreAllocateRuleID.SelectedValue = orderDetail.PreallocateRuleID;
                        }
                        if (!string.IsNullOrEmpty(orderDetail.AllocateRuleID) && (this.ddlAllocateRule.Items.FindByValue(orderDetail.AllocateRuleID) != null))
                        {
                            this.ddlAllocateRule.SelectedValue = orderDetail.AllocateRuleID;
                        }
                        if (!string.IsNullOrEmpty(orderDetail.SkuRotation) && (this.ddlSkuRotation.Items.FindByValue(orderDetail.SkuRotation) != null))
                        {
                            this.ddlSkuRotation.SelectedValue = orderDetail.SkuRotation;
                        }
                        this.hdnExternOrderID.Value = orderDetail.ExternOrderID;
                        List<WMS6.Web.CommonMethodServiceRef.UomList> uomList = this.ViewState["UOMLIST"] as List<WMS6.Web.CommonMethodServiceRef.UomList>;
                        this.hdnUomValue.Value = base.GetUomQtyByUomList(this.ddlUomID.SelectedValue, uomList).ToString();
                        this.txtCube.Text = base.GetPreferenceDigit(orderDetail.Cube);
                        this.hdnCube.Value = orderDetail.Cube.ToString();
                        this.txtGrossWgt.Text = base.GetPreferenceDigit(orderDetail.GrossWGT);
                        this.txtNetWgt.Text = base.GetPreferenceDigit(orderDetail.NetWGT);
                        this.txtLength.Text = base.GetPreferenceDigit(orderDetail.Length);
                        this.txtWidth.Text = base.GetPreferenceDigit(orderDetail.Width);
                        this.txtHeight.Text = base.GetPreferenceDigit(orderDetail.Height);
                        this.txtSalsePrice.Text = base.GetPreferenceDigit(orderDetail.UnitPrice.ToString());
                        this.hdnUnitPrice.Value = base.GetPreferenceDigit(orderDetail.UnitPrice.ToString());
                        this.txtExtemdedrice.Text = base.GetPreferenceDigit(orderDetail.ExtendedPrice.ToString());
                        this.ddlUomID.SelectedValue = orderDetail.UomID;
                        this.txtOriginalQty.Text = base.GetPreferenceDigit(orderDetail.OriginalQty);
                        this.txtPreallocatedQty.Text = base.GetPreferenceDigit(orderDetail.PreallocatedQty);
                        this.txtAllocatedQty.Text = base.GetPreferenceDigit(orderDetail.AllocatedQty);
                        this.txtPackedQty.Text = base.GetPreferenceDigit(orderDetail.PickedQty);
                        this.txtShippedQty.Text = base.GetPreferenceDigit(orderDetail.ShippedQty);
                        this.txtVendorID.Text = orderDetail.VendorID;
                        this.txtReceiptDate.Text = base.GetPreferenceShortDate(orderDetail.ReceiptDate);
                        this.txtOriginalLineID.Text = orderDetail.OriginalLineID;
                        this.txtOriginalSku.Text = orderDetail.OriginalSku;
                        this.chkboxIsSubStitute.Checked = orderDetail.IsSubstitute != 0;
                        this.chkboxOk2SubStitute.Checked = orderDetail.OkToSubstitute != 0;
                        this.hdnIntransitID.Value = orderDetail.IntransitID;
                        this.txtUdf1.Text = orderDetail.Udf1;
                        this.txtUdf2.Text = orderDetail.Udf2;
                        this.txtUdf3.Text = orderDetail.Udf3;
                        this.txtUdf4.Text = orderDetail.Udf4;
                        this.txtUdf5.Text = orderDetail.Udf5;
                        this.txtUdf6.Text = orderDetail.Udf6;
                        this.txtUdf7.Text = orderDetail.Udf7;
                        this.txtUdf8.Text = orderDetail.Udf8;
                        this.txtUdf9.Text = orderDetail.Udf9;
                        this.txtUdf10.Text = orderDetail.Udf10;
                        this.txtRemark.Text = orderDetail.Remark;
                        this.txtPickingInstuctions.Text = orderDetail.PickingInstructions;
                        this.hdnLot1.Value = orderDetail.LotAttr01;
                        this.hdnLot2.Value = orderDetail.LotAttr02;
                        this.hdnLot3.Value = orderDetail.LotAttr03;
                        this.hdnLot4.Value = orderDetail.LotAttr04;
                        this.hdnLot5.Value = orderDetail.LotAttr05;
                        this.hdnLot6.Value = orderDetail.LotAttr06;
                        this.hdnLot7.Value = orderDetail.LotAttr07;
                        this.hdnLot8.Value = orderDetail.LotAttr08;
                        this.hdnLot9.Value = orderDetail.LotAttr09;
                        this.hdnLot10.Value = orderDetail.LotAttr10;
                        this.hdnExpiryDate.Value = base.GetPreferenceShortDate(orderDetail.ExpiryDate);
                        this.hdnProductDate.Value = base.GetPreferenceShortDate(orderDetail.ProduceDate);
                        this.hdnExternal.Value = orderDetail.ExternalLot;
                        base.DataEntityViewState = orderDetail;
                    }
                }
            }
        }

        protected void txtExpectedQty_TextChanged(object sender, EventArgs e)
        {
            try
            {
                if (!string.IsNullOrEmpty(this.txtOriginalQty.Text.Trim()))
                {
                    if (float.Parse(this.txtOriginalQty.Text.Trim()) > 0f)
                    {
                        this.CalcSkuWgtCube();
                    }
                    else
                    {
                        this.lblMsg.Text = base.GetGlobalMsgResource("F4100_033");
                        this.lblMsg.Visible = true;
                    }
                }
            }
            catch (Exception)
            {
                this.lblMsg.Text = base.GetGlobalMsgResource("F4100_034");
                this.lblMsg.Visible = true;
            }
            this.hdnPageType.Value = "0";
            this.txtOriginalQty.Focus();
        }

        protected void txtPackID_TextChanged(object sender, EventArgs e)
        {
            this.BindData2UomList(this.txtPackID.Text.Trim());
            this.txtPackID.Focus();
            this.hdnPageType.Value = "0";
        }

        protected void txtSalsePrice_TextChanged(object sender, EventArgs e)
        {
            double doubleTemp = 0.0;
            if (double.TryParse(this.txtOriginalQty.Text.Trim(), out doubleTemp) && double.TryParse(this.txtSalsePrice.Text.Trim(), out doubleTemp))
            {
                this.txtExtemdedrice.Text = (double.Parse(this.txtOriginalQty.Text.Trim()) * double.Parse(this.txtSalsePrice.Text.Trim())).ToString();
            }
            this.hdnUnitPrice.Value = this.txtSalsePrice.Text.Trim();
            this.CalcSkuWgtCube();
        }

        protected void txtSkuID_TextChanged(object sender, EventArgs e)
        {
            try
            {
                string skuID = this.txtSkuID.Text.Trim();
                if (string.IsNullOrEmpty(skuID))
                {
                    this.txtSkuDesrc.Text = "";
                    this.txtPackID.Text = "";
                    this.txtSalsePrice.Text = "";
                    this.hdnUnitPrice.Value = "";
                    this.txtExtemdedrice.Text = "";
                    this.ddlUomID.Items.Clear();
                    this.txtCube.Text = "";
                    this.hdnCube.Value = "";
                    this.txtGrossWgt.Text = "";
                    this.hdnGrossWgt.Value = "";
                    this.txtNetWgt.Text = "";
                    this.hdnNetWgt.Value = "";
                    this.txtLength.Text = "";
                    this.txtWidth.Text = "";
                    this.txtHeight.Text = "";
                }
                else
                {
                    SkuInfo skuInfo = BaseInfoDetailServiceClientProxy.GetInstance().GetDetailInfoByID(this.hdnOwnerID.Value, skuID, "", "SKU") as SkuInfo;
                    if ((((skuInfo != null) && !string.IsNullOrEmpty(skuInfo.SkuID)) && !string.IsNullOrEmpty(skuInfo.OwnerID)) && (skuInfo.IsActive == "Y"))
                    {
                        this.txtInvQty.Text = base.GetPreferenceDigit(CommoneMethodServiceClientProxy.GetInstance().GetAvailableQty(skuInfo.OwnerID, skuInfo.SkuID));
                        this.txtSkuDesrc.Text = skuInfo.Descr;
                        this.txtPackID.Text = skuInfo.PackID;
                        this.txtCube.Text = base.GetPreferenceDigit(skuInfo.Cube);
                        this.hdnCube.Value = this.txtCube.Text;
                        this.txtGrossWgt.Text = base.GetPreferenceDigit(skuInfo.GrossWgt);
                        this.hdnGrossWgt.Value = this.txtGrossWgt.Text;
                        this.txtNetWgt.Text = base.GetPreferenceDigit(skuInfo.NetWgt);
                        this.hdnNetWgt.Value = this.txtNetWgt.Text;
                        this.txtLength.Text = base.GetPreferenceDigit(skuInfo.Length);
                        this.txtWidth.Text = base.GetPreferenceDigit(skuInfo.Width);
                        this.txtHeight.Text = base.GetPreferenceDigit(skuInfo.Height);
                        if (!string.IsNullOrEmpty(skuInfo.PreallocateRuleID))
                        {
                            if (this.ddlPreAllocateRuleID.Items.FindByValue(skuInfo.PreallocateRuleID) != null)
                            {
                                this.ddlPreAllocateRuleID.SelectedValue = skuInfo.PreallocateRuleID;
                            }
                        }
                        else
                        {
                            this.ddlPreAllocateRuleID.Items.Insert(0, "");
                        }
                        if (!string.IsNullOrEmpty(skuInfo.AllocateRuleID))
                        {
                            if (this.ddlAllocateRule.Items.FindByValue(skuInfo.AllocateRuleID) != null)
                            {
                                this.ddlAllocateRule.SelectedValue = skuInfo.AllocateRuleID;
                            }
                        }
                        else
                        {
                            this.ddlAllocateRule.Items.Insert(0, "");
                        }
                        if (!string.IsNullOrEmpty(skuInfo.RotationRuleID))
                        {
                            if (this.ddlSkuRotation.Items.FindByValue(skuInfo.RotationRuleID) != null)
                            {
                                this.ddlSkuRotation.SelectedValue = skuInfo.RotationRuleID;
                            }
                        }
                        else
                        {
                            this.ddlSkuRotation.Items.Insert(0, "");
                        }
                        this.txtSalsePrice.Text = base.GetPreferenceDigit(skuInfo.SalePrice.ToString());
                        this.hdnUnitPrice.Value = base.GetPreferenceDigit(skuInfo.SalePrice.ToString());
                        if (!string.IsNullOrEmpty(this.txtOriginalQty.Text.Trim()))
                        {
                            this.txtExtemdedrice.Text = base.GetPreferenceDigit((float.Parse(this.txtOriginalQty.Text.Trim()) * float.Parse(this.txtSalsePrice.Text.Trim())).ToString());
                        }
                        this.BindData2UomList(this.txtPackID.Text.Trim());
                        this.txtOriginalQty.Focus();
                    }
                    else
                    {
                        this.lblMsg.Text = base.GetGlobalMsgResource("F7100_032");
                        this.txtSkuID.Focus();
                    }
                }
            }
            catch (Exception ex)
            {
                this.lblMsg.Text = ex.Message;
                this.txtSkuID.Focus();
            }
            finally
            {
                ScriptManager.RegisterStartupScript(this.Page, base.GetType(), "", "<script language='javascript'>CloseSearch();false;</script>", false);
            }
            this.hdnPageType.Value = "0";
        }

        protected void txtUnitChanged_TextChanged(object sender, EventArgs e)
        {
            if ((!string.IsNullOrEmpty(this.txtLength.Text.Trim()) && !string.IsNullOrEmpty(this.txtWidth.Text.Trim())) && !string.IsNullOrEmpty(this.txtHeight.Text.Trim()))
            {
                List<CommonMethodServiceRef.UomList> uomList = this.ViewState["UOMLIST"] as List<CommonMethodServiceRef.UomList>;
                float uomQty = base.GetUomQtyByUomList(this.ddlUomID.SelectedValue, uomList);
                this.hdnUomValue.Value = uomQty.ToString();
                if (uomQty > 0f)
                {
                    float expectedQty = string.IsNullOrEmpty(this.txtOriginalQty.Text.Trim()) ? 0f : float.Parse(this.txtOriginalQty.Text.Trim());
                    float cube = (float.Parse(this.txtLength.Text.Trim()) * float.Parse(this.txtWidth.Text.Trim())) * float.Parse(this.txtHeight.Text.Trim());
                    this.hdnCube.Value = cube.ToString();
                    this.txtCube.Text = base.GetPreferenceDigit((float) ((cube * uomQty) * expectedQty));
                }
            }
            else
            {
                this.txtCube.Text = base.GetPreferenceDigit(0);
                this.hdnCube.Value = this.txtCube.Text;
            }
        }

        protected void txtVendorID_TextChanged(object sender, EventArgs e)
        {
            try
            {
                if (!string.IsNullOrEmpty(this.txtVendorID.Text))
                {
                    VendorInfo vendor = BaseInfoServiceClientProxy.GetInstance().GetInfoByID(this.txtVendorID.Text, "VENDOR") as VendorInfo;
                    if (vendor == null)
                    {
                        this.lblMsg.Text = base.GetGlobalMsgResource("F4100_032");
                    }
                }
            }
            catch (Exception ex)
            {
                this.lblMsg.Text = ex.Message;
            }
            this.hdnPageType.Value = "0";
            this.txtVendorID.Focus();
        }
    }
}

